<?php
include_once "xAP-functions/webincludes.php";

$extradata["sourceid"]=intval($_GET["id"]);

$now=date("Y-m-d H:i:s");

if(intval($extradata["sourceid"])>0){
	// just one source
	$sql="select * from xAP_Weather_Source
	where Active=1 and SourceID=".intval($extradata["sourceid"])."
	";
	$results=dbquery($sql);
}
else
{
	// all sources
	$sql="SELECT xap_pictures_item.ItemID,xap_pictures_item.CreatedDateStamp 
	FROM xap_pictures_item inner join xAP_pictures_source on xAP_pictures_source.sourceid=xAP_pictures_item.sourceid 
	where xAP_pictures_source.SourceType=1 order by itemid desc limit 40;
	";
	$results=dbquery($sql);

	krsort($results);//reverse order

}


//display
$body= "";
foreach($results as $row){

$body.= $row["ItemID"]."=".$row["CreatedDateStamp"]."~";
}

echo $body;
?>